nonlin_polynomials Module



Interfaces

public interface assignment(=)

Defines polynomial assignment.

  • private pure subroutine poly_equals(x, y)

    Assigns the contents of one polynomial to another.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(inout) :: x

    The assignee.

    class(polynomial), intent(in) :: y

    The item to copy.

  • private pure subroutine poly_dbl_equals(x, y)

    Assigns a number to each coefficient of the polynomial.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(inout) :: x

    The assignee.

    real(kind=real64), intent(in) :: y

    The value to assign.

  • private pure subroutine poly_equals_array(x, y)

    Assigns the contents of an array as polynomial coefficients.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(inout) :: x

    The assignee.

    real(kind=real64), intent(in), dimension(:) :: y

    The coefficient array.

public interface operator(*)

Defines polynomial multiplication

  • private pure function poly_poly_mult(x, y) result(z)

    Multiplies two polynomials.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(in) :: x

    The left-hand-side argument.

    class(polynomial), intent(in) :: y

    The right-hand-side argument.

    Return Value type(polynomial)

    The resulting polynomial.

  • private pure function poly_dbl_mult(x, y) result(z)

    Multiplies a polynomial by a scalar value.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(in) :: x

    The left-hand-side argument.

    real(kind=real64), intent(in) :: y

    The right-hand-side argument.

    Return Value type(polynomial)

    The resulting polynomial.

  • private pure function dbl_poly_mult(x, y) result(z)

    Multiplies a polynomial by a scalar value.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: x

    The left-hand-side argument.

    class(polynomial), intent(in) :: y

    The right-hand-side argument.

    Return Value type(polynomial)

    The resulting polynomial.

public interface operator(+)

Defines polynomial addition.

  • private pure function poly_poly_add(x, y) result(z)

    Adds two polynomials.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(in) :: x

    The left-hand-side argument.

    class(polynomial), intent(in) :: y

    The right-hand-side argument.

    Return Value type(polynomial)

    The resulting polynomial.

public interface operator(-)

Defines polynomial subtraction.

  • private pure function poly_poly_subtract(x, y) result(z)

    Subtracts two polynomials.

    Arguments

    Type IntentOptional Attributes Name
    class(polynomial), intent(in) :: x

    The left-hand-side argument.

    class(polynomial), intent(in) :: y

    The right-hand-side argument.

    Return Value type(polynomial)

    The resulting polynomial.

public interface polynomial

  • private function poly_init_1(order) result(rst)

    Initializes a new polynomial instance.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: order

    The order of the polynomial (must be >= 0).

    Return Value type(polynomial)

    The new polynomial object.

  • private function poly_init_2(c) result(rst)

    Initializes a new polynomial instance.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:) :: c

    The array of polynomial coefficients. The coefficients are established as follows: c(1) + c(2) * x + c(3) * x2 + ... c(n) * xn-1.

    Return Value type(polynomial)

    The new polynomial object.


Derived Types

type, public ::  polynomial

Defines a polynomial, and associated routines for performing polynomial operations.

Constructor

private function poly_init_1 (order)

Initializes a new polynomial instance.

private function poly_init_2 (c)

Initializes a new polynomial instance.

Type-Bound Procedures

procedure, public :: companion_mtx => poly_companion_mtx
procedure, public :: divide => poly_divide
generic, public :: evaluate => evaluate_real, evaluate_complex
procedure, public :: fit => poly_fit
procedure, public :: fit_thru_zero => poly_fit_thru_zero
procedure, public :: get => get_poly_coefficient
procedure, public :: get_all => get_poly_coefficients
generic, public :: initialize => init_poly, init_poly_coeffs
procedure, public :: order => get_poly_order
procedure, public :: roots => poly_roots
procedure, public :: set => set_poly_coefficient